{% comment %}
<!--
  Copyright (C) 2008 ZHENG Zhong <http://www.zhengzhong.net/>

  Created on 2009-04-08.
  $Id$
-->
{% endcomment %}

<div id="address" class="ajax_box">

  {% include "foodsnroses/ajax/ajax_error.html" %}
  
  <!-- view _____________________________________________________________________________________-->
  
  <div class="view">
  
    <span class="h2">
      {{resto.address|escape}} -
      <a href="{{webapp_}}/search/post_code/?value={{resto.post_code|escape}}">
        {{resto.post_code|escape}}
      </a>
      <a href="{{webapp_}}/search/city/?value={{resto.city|escape}}">
        {{resto.city.capitalize|escape}}
      </a>
    </span>
    
    {% if resto.is_manageable %}
      <span class="toggle_link">
        <a href="javascript:void(0);" onclick="toggleBox('#address');">[edit]</a>
      </span>
    {% endif %}
  
  </div><!--/.view-->
  
  <!-- edit _____________________________________________________________________________________-->
  
  {% if resto.is_manageable %}
  
    <div class="edit hidden">
    
      <form id="update_address_form" class="form" action="." method="POST"
            onsubmit="return submitAjaxForm('#address', '#update_address_form');">
        <input type="hidden" name="ajax_box" value="address"/>
        <table>
          <tbody>
            <tr>
              <th><span class="nowrap">Address:</span></th>
              <td colspan="3">
                <span class="nowrap">
                  <input style="width: 400px;"
                         type="text"
                         name="address"
                         value='{{resto.address|default:""|escape}}'/>
                </span>
              </td>
            </tr>
            <tr>
              <th><span class="nowrap">Post code:</span></th>
              <td width="150px;">
                <span class="nowrap">
                  <input style="width: 150px;"
                         type="text"
                         name="post_code"
                         value='{{resto.post_code|default:""|escape}}'/>
                </span>
              </td>
              <th><span class="nowrap">City:</span></th>
              <td>
                <span class="nowrap">
                  <input style="width: 150px;"
                         type="text"
                         name="city"
                         value='{{resto.city|default:""|escape}}'/>
                </span>
              </td>
            </tr>
            <tr>
              <th></th>
              <td colspan="3">
                <span class="nowrap">
                  <input class="button" type="submit" value="Update"/>
                  <input class="button" type="button" onclick="toggleBox('#address');" value="Cancel"/>
                  <span class="ajax_indicator hidden">
                    <img src="{{static_}}/images/ajax_indicator.gif" alt="AJAX Indicator"/>
                  </span>
                </span>
              </td>
            </tr>
          </tbody>
        </table>
      </form>
    
    </div><!--/.edit-->
  
  {% endif %}

</div><!--/#address-->


